<template>
  <div class="bnh-auth-cont">
      <div class="bnh-auth-item border flex flex-align-center" @click="onClickInput">
          <p class="flex-1">头像</p>
          <div class="auth-head-box">
              <img src="@/assets/img/head.png" alt="">
          </div>
          <input type="flie" hidden @click="onChangeHeadImg" id='onChange'>
          <img class="auth-right" src="@/assets/img/auth-right.png" alt="">
      </div>
      <div class="bnh-auth-item border flex flex-align-center">
          <p class="flex-1">昵称</p>
          <input type="text" value="未设置">
      </div>
      <div class="bnh-auth-item border flex flex-align-center" @click="onBind">
          <p class="flex-1">联系电话</p>
          <p style="color:#ccc">已绑定</p>
          <img class="auth-right" src="@/assets/img/auth-right.png" alt="">    
      </div>   
      <div class="bnh-auth-item border flex flex-align-center" @click="onAuth">
          <p class="flex-1">实名认证</p>
          <p class="unAuth">未认证</p>
          <img class="auth-right" src="@/assets/img/auth-right.png" alt="">    
      </div>  
      <div class="bnh-auth-item border flex flex-align-center" @click="onPassWord">
          <p class="flex-1">修改密码</p>
          <img class="auth-right" src="@/assets/img/auth-right.png" alt="">    
      </div>    
       <div class="bnh-login-btn flex flex-align-center flex-pack-center" @click="onPost">
            <p>保存</p>
        </div> 
  </div>
</template>
<script>
import http from '../utils/http'
import api from '../utils/api'
import utils from '../utils/utils'
export default {
  	created(){ //页面初始化时修改网页标题
			window.document.title = '个人资料';
    },
    data(){
        return{
            headImg:'http://www.baidu.com',
            nickName:'Major_'
        }
    },
    methods:{
        onBind(){ //跳转到更换手机号页面
             this.$router.push({ path: '/bindtel' });
        },
        onAuth(){ //跳转到认证页面
             this.$router.push({ path: '/postauth' });
        },
        onPassWord(){ //修改密码
            this.$router.push({ path: '/forget?type=1'});
        },
        onChangeHeadImg:async function(){ //上传头像
            // const res = await http.get(api.getOssAccessSign);
            //   	if (res.data.success) {
            //         let signInfo = JSON.parse(res.data.signInfo);
            //         console.log(signInfo);

			// 	}else{
            //       this.$vux.toast.text(res.data.message, 'middle');
            //     }
        },
        onClickInput(){
            
        },
        onPost: async function(){ //提交资料
            let params = {headImg: this.headImg,nickName:this.nickName,dealerId:localStorage.id}
            const res = await http.post(api.updateDealer, params);
             if (res.data.success) {
                 this.$vux.toast.text(res.data.message, 'middle');
			 }else{
               this.$vux.toast.text(res.data.message, 'middle');
            }
        }
    }
}
</script>
<style scoped>
.bnh-auth-item{height: 1.37rem}
.bnh-auth-item p{margin-left: 0.3rem;font-weight: 500}
.auth-head-box{height: 0.99rem;width: 0.99rem;overflow: hidden;border-radius: 50%;margin-left: 4.89rem}
.auth-head-box img{width: 100%;height: 100%}
.bnh-auth-item input{width: 2.4rem;text-align: right;border:none;margin-right: 0.4rem}
.auth-right{height: 0.3rem;width: auto;margin-right: 0.2rem;margin-left: 0.2rem}
.unAuth{color: #ffaf3c}
.Auth{color: #ccc}
.bnh-login-btn{height: 0.95rem;width: 7rem;margin: 0 auto;border-radius: 25px;background: #ffaf3c;color: #fff;font-size: 0.32rem;margin-top: 0.66rem}
</style>
